package com.my.chapter18;

import net.mindview.util.BinaryFile;

import java.io.*;
import java.util.*;

public class practice19 {
    static String path = ".\\src\\com\\my\\chapter18\\";
    public static void main(String[] args) throws IOException {
        Map<Byte,Integer> bytesStat =
                new HashMap<Byte,Integer>();
        for(Byte bt : BinaryFile.read(path + "practice19.java")) {
            Integer freq = bytesStat.get(bt);
            bytesStat.put(bt, freq == null ? 1 : freq + 1);
        }
        List<Byte> keys =
                new ArrayList<Byte>(bytesStat.keySet());
        Collections.sort(keys);
        for(Byte key : keys)
            System.out.println(key + " => " + bytesStat.get(key));
    }
}
